
This is the README file for the replication materials associated with: 

Pomeroy C, Dasandi N, Mikhaylov SJ (2019) Multiplex communities and the emergence of international conflict. PLoS ONE 14(10): e0223040. https://doi.org/10.1371/journal.pone.0223040

To reproduce the results, download the files from Dataverse, and preserve the tree structure of the folders. All necessary data, including pre-trained embeddings, are available in the repo. To train your own embeddings or to estimate the RWMDs locally using the pre-trained embeddings, download the United Nations General Debate corpus (https://doi.org/10.7910/DVN/0TJX8Y) and place the corpus in a folder entitled "speeches" on the downloaded repo path data/raw/speeches/[yearly folders].

The analysis pipeline is ordered as follows:

`multi_weak_data_manipulation_rep.R': trains embeddings, creates yearly matrices of RWMD speech similarities, creates yearly matrices of UN vote similarities, and performs mutual 5-NN graph clustering on both sets of matrices.

`multi_strong_data_manipulation_rep.R': constructs yearly adjacency matrices of bilateral cooperation agreements from the WTI, both for the master node set (all available countries) and weak node set (countries who voted and delivered a UNGA speech in a given year).

`multi_me_rep.R': performs multilayer community detection using the Multilayer Extraction algorithm on the weak signal (speech and vote) graphs and strong signal (cooperation agreement) graphs. For more on the M-E procedure, see https://github.com/jdwilson4/MultilayerExtraction.

`multi_pc_data_prep_rep.R': prepares data used in Pauls & Cranmer (2017) (https://doi.org/10.1016/j.physa.2017.04.177) to match our node sets and time range for inferential analysis.

`multi_tergms_rep.R': performs inference using temporal exponential random graph models; outcome network represents interstate conflict in a given year and the primary predictors are our detected communities and nodal roles within those communities.

`multi_gof_rep.R': conducts in-sample goodness of fit and assesses out-of-sample performance for each of the models.

`multi_figs_rep.R': reproduces the figures used in the paper. 

Notes: all analysis was carried out using R version 3.4.4 and RStudio version 1.1.383. Required packages (which may require installation) are listed at the beginning of the scripts.
